package com.group4.xiao_ge_lai_yi_zhu.controller.change_prize_controller;

import com.group4.xiao_ge_lai_yi_zhu.controller.login_controller.BuyPage;
import com.group4.xiao_ge_lai_yi_zhu.factory.LotteryFactory;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimerTask;

public class JiShiQi extends TimerTask {
    public static String[] nums;
    public static Date date;

    @Override
    public void run() {
        date = runTime();
    }

    public Date runTime() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        BuyPage buyPage = new BuyPage();
        String num = buyPage.automaticSelection();

        String[] nums = num.split(" ");
        this.nums = nums;
        LotteryFactory.i++;


//        Date now = new Date();
//        System.out.println("当前时间：" + sdf.format(now));
//        Calendar nowTime = Calendar.getInstance();
//        nowTime.add(Calendar.MINUTE, 10);
//        System.out.println(sdf.format(nowTime.getTime()));

        String format = sdf.format(new Date());
        Date startTime = null;
        try {
            startTime = sdf.parse(format);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        Date afterDate = new Date(startTime.getTime() + 60000);
        return afterDate;
    }
}
